﻿package  
{
	
	/**
	* ...
	* @author DefaultUser (Tools -> Custom Arguments...)
	*/
	import flash.events.TimerEvent;
	import flash.display.Sprite;
	import Box2D.Common.Math.b2Vec2;
	public class Goat extends Obstacle
	{
		private var velocity:Number = 0;
		
		public function Goat(X:Number, Y:Number,animation:AnimatedSprite) 
		{
			super(X, Y);
			var explode:Animation = new Animation(8);
			var idle:Animation = new Animation(12);
				
				
			idle.FramesPerSecond = 15;
			explode.FramesPerSecond = 20;
				
			
			this._animation = animation;
			
			
			
			

			this._animation.Animations["goat"] = idle;
			this._animation.Animations["goat_die"] = explode;
			this._animation.CurrentAnimation = "goat";
			this._animation.StartAnimation();
			this.addChild(_animation);
		}
		public override function Update():Boolean
		{
			
			
			
			this.y += velocity;
			velocity += 0.0755;
			
			this.position.x =  this.x / 30;
			this.position.y = this.y / 30;
			
			//return true;
			return super.Update();
		}
		

		public override function Dispose():void
		{
			
			this._animation.CurrentAnimation = "goat_die";
			super.Dispose();
		
			
		
			
				Main.sound.play("baah");
		}
		
	}
	
}